﻿using System.Data.Entity.ModelConfiguration;
using INSE6260.OnlineBanking.Model.Accounts;
using System.ComponentModel.DataAnnotations;

namespace INSE6260.OnlineBanking.Repository.EF.Mappings
{
    public class AccountTypeConfiguration : EntityTypeConfiguration<Account>
    {

        public AccountTypeConfiguration()
        {					
    		this.HasKey(t => t.Id);		
    		this.ToTable("Account");
    		this.Property(t => t.Id).HasColumnName("Id").HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
    		this.Property(t => t.ClientId).HasColumnName("ClientId");
    		this.Property(t => t.AccountType).HasColumnName("AccountType").IsRequired().IsUnicode(false).IsFixedLength().HasMaxLength(2);
    		this.Property(t => t.Balance).HasColumnName("Balance");
    		this.Property(t => t.OpenDate).HasColumnName("OpenDate");
    		this.Property(t => t.WPD).HasColumnName("WPD");
    		this.Property(t => t.WPT).HasColumnName("WPT");
    		this.HasRequired(t => t.Client).WithMany(t => t.Accounts).HasForeignKey(d => d.ClientId);
    	}
    }
}
